package com.net.xpay.core.manager;

import com.net.common.manager.VersionedManager;
import com.net.xpay.core.domain.PayTrans;
import com.net.xpay.core.enums.PayTransStatus;
import com.net.xpay.core.model.PayTransSearchModel;
import com.net.xpay.core.model.QueryRepeatModel;

import java.time.LocalDateTime;
import java.util.List;


public interface PayTransManager extends VersionedManager<Long,PayTrans> {
    List<PayTrans> listByPayTransBatchId(Long userId, Long payTransBatchId);

    int batchSave(List<PayTrans> payTrans);

    int updateStatusByPayTransBatchId(Long userId, Long payTransBatchId, PayTransStatus status, Boolean free, LocalDateTime endTime);

    List<PayTrans> findByUserIdAndOutBizNoIn(Long userId, List<String> outBizNos);

    List<PayTrans> search(PayTransSearchModel searchModel);

    List<PayTrans> list(PayTransSearchModel searchModel);

    long searchCount(PayTransSearchModel searchModel);

    int batchUpdate(List<PayTrans> payTrans);

    PayTrans findByImportBizNo(Long userId, String importBatchNo, String importBizNo);

    long statSingleVeryCount(LocalDateTime startTime, LocalDateTime endTime);

    List<Long> listSingleVeryMerchantIds(LocalDateTime startTime, LocalDateTime endTime);

    List<QueryRepeatModel> queryMayRepeatPayTransWithType1(Long userId, LocalDateTime minCreateTime, LocalDateTime maxCreateTime);

    List<QueryRepeatModel> queryMayRepeatPayTransWithType2(Long userId, LocalDateTime minCreateTime, LocalDateTime maxCreateTime);

    PayTrans findById(Long userId, Long id);
    //统计单笔超过500元的失败笔数
    long statFailSingleVeryCount(LocalDateTime minEndTime, LocalDateTime maxEndTime);
    /**
     *  用户统计单笔超过500元的成功笔数
     */
    long statUserSingleVeryCount(Long userId, LocalDateTime minEndTime, LocalDateTime maxEndTime);
    /**
     * 用户统计单笔超过500元的失败笔数
     *
     */
    long statUserFailSingleVeryCount(Long userId, LocalDateTime minEndTime, LocalDateTime maxEndTime);
    /**
     * 用户统计收款支付宝
     *
     */
    long statPayTransPayeeAlipayAccount(LocalDateTime minEndTime, LocalDateTime maxEndTime);
    /**
     *  用户统计单笔超过10000元的成功笔数
     */
    long statUserLargeCount(Long userId, LocalDateTime minEndTime, LocalDateTime maxEndTime);
}
